package com.itheima.sh.feign;

import com.itheima.sh.feign.fallback.UserFeignFallBackApi;
import com.itheima.sh.pojos.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Description:  服务接口是由 服务提供方编写
 * @Version: V1.0
 */
//@FeignClient("user-service")  // Eureka 获取到服务实例名称
@FeignClient(value = "user-service", fallback = UserFeignFallBackApi.class)
//@Primary
public interface FeignApi {

    // 服务提供方提供接口方法
    // Feign 对SpringMvc注解增强
    @GetMapping("/user/{id}")
    public User queryById(@PathVariable("id") String username);

//    @PostMapping("user/add")
//    public void add(@RequestBody User user);

}
